<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>123</li>
    </ul>
    <script>
        // 创建元素节点
        var li = document.createElement('li');
        var ul = document.querySelector('ul');
        // 添加元素节点 node.appqndChild(child) node 父级 child 是子级 后面追加
        ul.appendChild(li);
        var lili = document.createElement('li');
        // 添加节点 node.insertBefore(child, 指定元素)
        ul.insertBefore(lili,ul.children[0]);
    </script>
</body>
</html>